import {
    SET_COUPONLIST,
    SET_RETURNQUOTA
} from '../type'
export default {
    state: {
        couponList:{},
        returnQuota:{}
    },
    getters: {
        couponList(state) {
            return state.couponList
        },
        returnQuota(state){
            return state.returnQuota
        }
    },
    mutations: {
        [SET_COUPONLIST]: (state, couponList) => {
            state.couponList = couponList
            sessionStorage.setItem('couponList', JSON.stringify(couponList))
        },
        [SET_RETURNQUOTA]: (state, returnQuota) => {
            state.returnQuota = returnQuota
            sessionStorage.setItem('returnQuota', JSON.stringify(returnQuota))
        },
    },
    actions: {
        setCouponList ({ commit }, couponList) {
            commit(SET_COUPONLIST, couponList)
        },
        setReturnQuota ({ commit }, returnQuota) {
            commit(SET_RETURNQUOTA, returnQuota)
        },
    }
}